package cn.bulibuqi.myblog.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;



import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;

/**
 * @author bulibuqi
 * @create 2021-12-14:04
 */
@Data
@TableName("type")//默认是类名
public class Type {
    @TableId(type = IdType.AUTO)
    private Long id;
    @NotBlank(message = "分类名称不能为空") //会抛出异常
    private String  name;
    @TableField(exist = false)
    private List<Blog> blogs = new ArrayList<>();


    public Type(String name){
        this.name=name;
    }

    public Type() {
    }
}
